<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/custom-html.tld" prefix="chtml" %>

<%@ page import="com.erp.framework.util.CommonUtil"%>
<%@ page import="com.erp.app.common.ProjectConstants"%>
<%@ page import="com.erp.app.catalog.login.web.CatalogLoginAction"%>
<%@ page import="com.erp.app.catalog.itemMaster.vo.ItemMasterDtlVO"%>

<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Hashtable"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Iterator"%>

<meta http-equiv="Content-Type" content="text/html; charset=big5">
<link rel="stylesheet" href="stylesheet/style1.css" type="text/css">
<link href="<%= request.getContextPath()%>/css/catalogCss/global.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath()%>/css/catalogCss/buttons.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath()%>/css/catalogCss/forms.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath()%>/css/catalogCss/tables.css" rel="stylesheet" type="text/css" />

<jsp:useBean id="catalogLoginForm" scope="session" type="com.erp.app.catalog.login.web.CatalogLoginForm" />

<table class="table_grid">
	 <logic:present  name="catalogLoginForm" property="itemMasterVos">    	
		<logic:iterate id="itemVo" name="catalogLoginForm" property="itemMasterVos" indexId="idx"  type="com.erp.app.catalog.itemMaster.vo.ItemMasterVO">

			<%if (idx.intValue()>=catalogLoginForm.getSidx() && idx.intValue()<(catalogLoginForm.getSidx()+CatalogLoginAction.MAX_SHOW_PAGE)){%>
			<tr id="detail_row" <%=(idx.intValue()%2 == 0)? "class='detail_result1'": "class='detail_result2'"%>>
				<td rowspan="4" nowrap="nowrap" id="view_detail" width="100">						
					<img src="<%=catalogLoginForm.getSearchImageFile(request, itemVo, idx.intValue())%>"	
						width="96" height="96" border="0" />
					<a href = "catalogLogin.do?pageEvent=<%=CatalogLoginAction.ACTION_ITEM_PIC_DETAIL%>&pageEventSrc=<%=itemVo.getFabricCode()%>">
						<bean:write name="itemVo" property="fabricCode"/>
					</a>
				</td>
				<td colspan="4" id="view_detail">
					<h4>
						<a href="#"></a>
					</h4>
				</td>
			 </tr>
			<%
				ArrayList itemDtlVos = itemVo.getItemDtlVO();
				int itemDtlVosSize = (CommonUtil.isEmpty(itemDtlVos))?0:itemDtlVos.size();
				
				for (int i=0; i<6||i<itemDtlVosSize||(i%2==1); i++){
			%>
				<%=(i%2==0)?("<tr id='detail_row' class='"
							+((idx.intValue()%2 == 0)? "detail_result1": "detail_result2")
							+"'>"):""%>
				<%=(i%2==0&&i>=6)?"<td id='view_detail'></td>":""%>
					<td id="view_detail">
						<label>
							<%=(i<itemDtlVosSize)?((ItemMasterDtlVO)itemDtlVos.get(i)).getDtlName():""%>
						</label>
					</td>
					<td id="view_detail">
						<%=(i<itemDtlVosSize)?((ItemMasterDtlVO)itemDtlVos.get(i)).getDtlValue():""%>
					</td>				
				<%=(i%2==0)?"":"</tr>"%>
			<%}%>
			<%}%>
		</logic:iterate>
	</logic:present>
</table>